<?php
/**
 * Date: 2016/2/23
 * Time: 11:30
 */
/*收支明细*/
namespace Futures\Controller;
use Think\Controller;
use Think\FuturesPage;

class PaymentsController extends BaseController{
    public function payments(){
        /*获取用户*/
        $user_auth= cookie('user_auth');
        $user_id=$user_auth['uid'];
        //$user_id = 410;
        //获取MONEY_LOG_TYPE的值
        $type = C('MONEY_LOG_TYPE');
        $types = array_flip($type);
        $this->assign('types',$types);
        /*查询收支明细*/
        $record = M('futures_fund_record');
        $count      = $record->where("user_id='".$user_id."'")->count();// 查询满足要求的总记录数
        $Page       = new FuturesPage($count,5);// 实例化分页类 传入总记录数和每页显示的记录数(25)
        //$Page->lastSuffix = false;//最后一页不显示为总页数
        $Page->setConfig(array());
        $show       = $Page->show();// 分页显示输出
        $per_num    = 10;//每页条数    自定义
        $pages      = ceil($count/$per_num);//总页数
        $this->assign('page',$show);
        $refer = $record->where("user_id='".$user_id."'")->limit($Page->firstRow.','.$Page->listRows)->order('id desc')->select();
        $this->assign("refer",$refer);
       //print_r($refer);exit;
        $url = U('Payments/payments','','');
        $this->assign('url',$url);
        $this->display();
    }
}
